#!/usr/bin/env bash

set -eu -o pipefail

top_dir="$(readlink -m "${BASH_SOURCE[0]}/../..")"
clean_dir="$top_dir.clean-check.clean"

if [ -n "${JENKINS_HOME:-}" ]; then
    clean_dir="/tmp/$(basename "$clean_dir")"
fi

rm -rf "$clean_dir"
cp -a "$top_dir" "$clean_dir"
